package com.peoit.honeycomb.dto;

import java.text.SimpleDateFormat;

import com.peoit.honeycomb.domain.ProjectNotice;

public class ProjectNoticeDto extends BaseDto {
	private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
	private String projectName; // 项目名称
	private String noticeTitle; // 公告标题
	private String noticeContent; // 公告内容
	private String userName; // 用户名称
	private String projectId;// 项目ID
	private String userId;// 用户ID
	private String createDate;// 创建时间

	public static ProjectNotice toEntity(ProjectNoticeDto dto) {
		ProjectNotice notice = new ProjectNotice();
		notice.setNoticeTitle(dto.getNoticeTitle());
		notice.setNoticeContent(dto.getNoticeContent());
		return notice;
	}

	public static ProjectNoticeDto toDto(ProjectNotice notice) {
		ProjectNoticeDto dto = new ProjectNoticeDto();
		dto.setNoticeTitle(notice.getNoticeTitle());
		dto.setNoticeContent(notice.getNoticeContent());
		dto.setProjectName(notice.getProject().getProjectName());
		dto.setUserName(notice.getUser().getUserName());
		dto.setProjectId(notice.getProject().getId());
		dto.setUserId(notice.getUser().getId());
		dto.setId(notice.getId());
		dto.setCreateDate(sdf.format(notice.getCreateTime()));
		return dto;
	}

	public String getCreateData() {
		return createDate;
	}

	public void setCreateDate(String createDate) {
		this.createDate = createDate;
	}

	public String getProjectId() {
		return projectId;
	}

	public void setProjectId(String projectId) {
		this.projectId = projectId;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getNoticeContent() {
		return noticeContent;
	}

	public void setNoticeContent(String noticeContent) {
		this.noticeContent = noticeContent;
	}

	public String getProjectName() {
		return projectName;
	}

	public void setProjectName(String projectName) {
		this.projectName = projectName;
	}

	public String getNoticeTitle() {
		return noticeTitle;
	}

	public void setNoticeTitle(String noticeTitle) {
		this.noticeTitle = noticeTitle;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

}
